package com.google.code.jholidays.moc;

import java.util.regex.Pattern;

import com.google.code.jholidays.core.EventDescriptor;
import com.google.code.jholidays.events.IEvent;
import com.google.code.jholidays.events.IFactory;

public class NumberFactoryMoc implements IFactory {

    @Override
    public IEvent createEvent(EventDescriptor descriptor, IEvent parent) {
	NumberEvent event = new NumberEvent(descriptor);
	return event;
    }

    @Override
    public boolean matches(EventDescriptor descriptor) {
	return regex.matcher(descriptor.getExpression()).matches();
    }

    Pattern regex = Pattern.compile("^\\d+$");
}
